﻿<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e) 
    {
        Utils.WebFramework.Framework framework = Utils.WebFramework.Framework.GetFramework();
        framework.MainPath = Server.MapPath("~");

        string controllers = ConfigurationManager.AppSettings["controllers"];
        if (string.IsNullOrEmpty(controllers))
        {
            controllers = "./bin/controllers.dll";
        }
        framework.ControllersPath = controllers;

        string business = ConfigurationManager.AppSettings["business"];
        if (string.IsNullOrEmpty(business))
        {
            business = "./bin/business.dll";
        }
        framework.BusinessPath = business;
        
        string dataAccess = ConfigurationManager.AppSettings["dataaccess"];
        if (string.IsNullOrEmpty(dataAccess))
        {
            dataAccess = "./bin/dataaccess.dll";
        }
        framework.DataAccessPath = dataAccess;
        
        string resourcePath = ConfigurationManager.AppSettings["resourcepath"];
        if (string.IsNullOrEmpty(resourcePath))
        {
            resourcePath = "./res/";
        }
        framework.ResourcePath = resourcePath;
        
        string connString = ConfigurationManager.AppSettings["connstring"];
        framework.ConnString = connString;
        
        string viewsPath = ConfigurationManager.AppSettings["viewspath"];
        if (string.IsNullOrEmpty(viewsPath))
        {
            viewsPath = "~/view";
        }
        framework.ViewsPath = viewsPath;
        
        string indexUrl = ConfigurationManager.AppSettings["indexurl"];
        if (string.IsNullOrEmpty(indexUrl))
        {
            indexUrl = "home/index.axd";
        }
        
        framework.IndexUrl = indexUrl;
        
        framework.Start();
    }
    
    void Application_End(object sender, EventArgs e) 
    {
        Utils.WebFramework.Framework.GetFramework().Exit();

    }
        
    void Application_Error(object sender, EventArgs e) 
    {
        Utils.WebFramework.Framework.GetFramework().Error = Server.GetLastError();
    }

    void Session_Start(object sender, EventArgs e) 
    {

    }

    void Session_End(object sender, EventArgs e) 
    {

    }
       
</script>
